<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
        .dice {
            width: 200px;
            height: 200px;
            position: relative;
            left: 300px;
            top: 200px;
            /*? 设置元素的子元素是位于 3D 空间中还是平面中。preserve-3d有元素遮挡关系*/
            transform-style: preserve-3d;
            transform: rotateX(45deg) rotateY(45deg);
        }
        .face {
            position: absolute;
            width: 100%;
            height: 100%;
            background-color: white;
            border: 1px solid black;
        }
        .front {
            transform: translateZ(100px);
        }

        .back {
            transform: translateZ(-100px);
        }

        .top {
            transform: rotateX(-90deg) translateZ(100px);
        }

        .bottom {
            transform: rotateX(90deg) translateZ(100px);
        }

        .left {
            transform: rotateY(-90deg) translateZ(100px);
        }

        .right {
            transform: rotateY(90deg) translateZ(100px);
        }
    </style>
</head>
<body>
<div class="dice">
    <div class="face front"></div>
    <div class="face back"></div>
    <div class="face top"></div>
    <div class="face bottom"></div>
    <div class="face left"></div>
    <div class="face right"></div>
</div>
</body>
</html>
